import bot from "../model/bot/amesu";
import func from "../model/func";
import { MsgAction, Tpl_mailRead } from "../shared/master/MsgAction";
import { style_default } from "../style/default";

export default async function (data: MsgAction) {
    let d = data.data as Tpl_mailRead;
    let s = new style_default();
    s.setTitle(`邮件阅读`,'✉️');
    s.addLine(`${d.title}`);
    s.addLine(`${d.content}`);
    if (d.annexs.length > 0) {
        s.addLine(`🏷️附件一览(已放入背包)`)
        for (let i = 0; i < d.annexs.length; i++) {
            const element = d.annexs[i];
            s.addLine(`${element.name}X${element.cont}`)
        }
    }
    s.addLine(`🧙${d.from.name}`);
    s.addLine(`🕜️${func.getTimeStr(d.create)}`);
    if (d.from.uuid.length > 0) {
        s.addLine(`🆔${d.from.uuid}`);
    }
    bot.sendText(data.tolocation, s.end());
}